<!doctype html>
<html>
<head>
	<meta charset="utf-8">
	<title>修改密码</title>
	<meta name="keywords" content="">
	<meta name="description" content="">
	<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
	<link rel="stylesheet" type="text/css" href="css/reset.css">
	<link rel="stylesheet" type="text/css" href="css/login-information.css">
	<style>
		#layout{
			border-top: 1px solid transparent;
			box-sizing: border-box;
			-webkit-box-sizing: border-box;
			-moz-box-sizing: border-box;
		}
		body,.gma-section,.gma-photo,#form {
			background: #fff;
		}
		.gma-section {
			padding-bottom: 1rem;
		}
	</style>
</head>
<body>
	<div id="layout">
		<header id="header">
	        <div id="topbar">
	            <a class="back" href="javascript:;"></a>
	        </div>
	    </header>
		<section class="gma-section" style="padding-top:1rem;margin-top: .86rem;">
			<form id="form" action="" method="">
				<div class="gma-tel"><input id="tel" type="tel" name="mobile" value="" placeholder="请输入手机号" maxlength="11" readonly="readonly"><p id="getCode" class="gma-btn act-ago">获取验证码</p></div>
				<div class="gma-pas gma-testCode"><input id="testCode" type="tel" name="smsCode" value="" placeholder="请输入验证码" maxlength="6"></div>
				<p id="notice" class="hide"></p>
				<p id="login-btn" class="gma-btn act-ago">下一步</p>
			</form>
		</section>
	</div>
</body>
<script type="text/javascript" src="plugins/jquery.min.js"></script>
<script type="text/javascript" src="plugins/touch.min.js"></script>
<script type="text/javascript" src="js/common.js"></script>
<script type="text/javascript" src="js/baseInfoForm.js"></script>
<script type="text/javascript">
var sendData={};
var globalHost=common.globalHost;
var validatePort=common.validatePort;
var url=globalHost+validatePort;
// var resultGetTestCode=baseInfoForm.getTestCode({targetSelector:baseInfoForm.getCode,type:'validate'});
var resultGetTestCode=baseInfoForm.getTestCode({targetSelector:baseInfoForm.getCode});
var $telInput=$('#tel');
var agentInfo=common.getLocalData('H5-agentInfo');
$telInput.val(agentInfo.mobile);
common.goBackNext();
baseInfoForm.submit.off('tap').on('tap',function(e){
	var $this=$(this);
    var checkCase=$this.hasClass("act-ago");
    	sendData=common.getSendDataByForm(baseInfoForm.form);
    var resultTestCode=baseInfoForm.testMobileCode({targetSelector:baseInfoForm.testCode,noticeMsg:"请输入验证码"});
    // var resultTel=baseInfoForm.regTestTel({targetSelector:baseInfoForm.tel,noticeMsg:"手机号",length:11});
    if(!!checkCase&&!!resultTestCode){
    	$this.removeClass("act-ago").addClass("acted-yet");
    	baseInfoForm.formPost({
            sendData:sendData,
            url:url,
            resSuccess:function(data){
            	actedStyle ();
            	var data=data.res.data;
            	common.setLocalStorage('H5-agentInfo',JSON.stringify(data));
				baseInfoForm.form[0].reset();    
    			window.location.href='changePasswordRun.html';
            },
            resFailed:function(data){
            	 actAgoStyle (); 
            }
       }); 
    }else{
    	console.log("不准发送ajax");
    }
 	e.preventDefault();
        return false;     
});	
function actedStyle () {
    baseInfoForm.submit.removeClass("act-ago").addClass("acted-yet");
}
function actAgoStyle () {
    baseInfoForm.submit.removeClass("acted-yet").addClass("act-ago");
}
</script>
</html>